#pragma once
#include <d3d9.h>
#include "DxVertexFormat.h"

class DxVertexBuffer
{
public:
	DxVertexBuffer(void);
	~DxVertexBuffer(void);

	bool CreateBuffer(int iCount);

	void SetPosition(int iVert, Vector4& vPos);
	void SetNormal(int iVert, Vector4& vNorm);
	void SetTexCoord(int iVert, Vector4& vTestCoord);
	void SetBlendIndices(int iVert, u32 uIndices);
	void SetBlendWeights(int iVert, Vector4& vWeights);

	bool Lock();
	bool UnLock();

	IDirect3DVertexBuffer9*			GetBuffer()				{ return m_pVertexBuffer; }
	IDirect3DVertexDeclaration9*	GetVertexDecleration()	{ return m_pFormat->GetDeclaration(); }
	int								GetStride()				{ return m_pFormat->GetSize(); }
	int								GetVertexCount()		{ return m_iVertCount; }
	int								GetSize()				{ return m_iSize; }

protected:
	 IDirect3DVertexBuffer9*	m_pVertexBuffer;
	 DxVertexFormat*			m_pFormat;
	 bool						m_bLocked;
	 u8*						m_pLockPointer;
	 int						m_iSize;
	 int						m_iVertCount;
};

